package com.iss.umservice.common;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import com.iss.iframework.util.DateUtil;

public class Week {
	private String currentDate;

	public String getDate2() {
		return date2;
	}

	public void setDate2(String date2) {
		this.date2 = date2;
	}

	public String getDate3() {
		return date3;
	}

	public void setDate3(String date3) {
		this.date3 = date3;
	}

	public String getDate4() {
		return date4;
	}

	public void setDate4(String date4) {
		this.date4 = date4;
	}

	public String getDate5() {
		return date5;
	}

	public void setDate5(String date5) {
		this.date5 = date5;
	}

	public String getDate6() {
		return date6;
	}

	public void setDate6(String date6) {
		this.date6 = date6;
	}

	public String getDate7() {
		return date7;
	}

	public void setDate7(String date7) {
		this.date7 = date7;
	}

	public void setCurrentDate(String currentDate) {
		this.currentDate = currentDate;
	}

	private String date2;
	private String date3;
	private String date4;
	private String date5;
	private String date6;
	private String date7;

	public Week() {

		String currentDate = DateUtil.getDate();
		try {
			setCurrentDate(currentDate);
			setDate2(DateUtil.dateToStr(DateUtil.addDay(new Date(), 1)));
			setDate3(DateUtil.dateToStr(DateUtil.addDay(new Date(), 2)));
			setDate4(DateUtil.dateToStr(DateUtil.addDay(new Date(), 3)));
			setDate5(DateUtil.dateToStr(DateUtil.addDay(new Date(), 4)));
			setDate6(DateUtil.dateToStr(DateUtil.addDay(new Date(), 5)));
			setDate7(DateUtil.dateToStr(DateUtil.addDay(new Date(), 6)));

		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public String getCurrentDate() {

		return currentDate;
	}

	public boolean before(String time1, String time2) {


				if(time1.substring(0,10).equals(time2.substring(0,10)))
				{

						int h1 =Integer.valueOf(time1.substring(11,13));
						String s1 = time1.substring(14,16);
						int h2 = Integer.valueOf(time2.substring(11,13));
						String s2 = time1.substring(14,16);
						
						if(h1<h2||(h1==h2&&(s1.equals(s2)||s1.equals("00"))))
						{
							return true;
						}
						else
						{
							return false;
						}
					
				}
				return false;

	}

	public String getAfter30Min(String currentTime) {
		String[] ss = currentTime.split(":");
		if (ss[1].equals("30")) {
			int hour = Integer.parseInt(ss[0]);
			hour = hour + 1;
			if(hour<10)
			{
				ss[0]="0"+String.valueOf(hour);
			}
			else
			{
				ss[0] = String.valueOf(hour);
			}
			ss[1] = "00";
		} else {
			ss[1] = "30";
		}
		return ss[0] + ":" + ss[1];
	}

}
